// 独立拆分并集中管理跟用户操作业务相关的网络请求
import request from '../utils/request'
// 登录
export const userLoginApi = (payload)=>{
  return request.get('/users',{
    params:payload
  })
}

// 注册（分配账号）
export const userRegisterApi = (payload)=>{
  return request.post('/users',payload)
}

// 用户信息更新
export const userUpdateApi = (id,payload)=>{
  return request.put('/users',payload,{
    params:{id}
  })
}

//角色新增
export const rolePostApi = (payload)=>{
  return request.post('/role',payload)
}

//角色列表
export const roleGetApi = (roleId)=>{
  let params = roleId ? {'id':roleId} : {}
  return request.get('/role',{
    params
  })
}

// 角色更新
export const roleUpdateApi = (id,payload)=>{
  return request.put('/role',payload,{
    params:{id}
  })
}